package com.ibeeking.found.file.rest.service.office.services;

import com.ibeeking.found.file.rest.service.office.entities.GroupEntity;
import com.ibeeking.found.file.rest.service.office.entities.PermissionEntity;
import com.ibeeking.found.file.rest.service.office.repositories.PermissionRepository;

import java.util.List;

//@Service
public class PermissionServices {

//    @Autowired
    private PermissionRepository permissionRepository;

    // create permissions with the specified parameters
    public PermissionEntity createPermission(List<GroupEntity> reviewGroupEntities,
                                             List<GroupEntity> commentViewGroupEntities,
                                             List<GroupEntity> commentEditGroupEntities,
                                             List<GroupEntity> commentRemoveGroupEntities,
                                             List<GroupEntity> userInfoGroupEntities,
                                             Boolean chat){

        PermissionEntity permissionEntity = new PermissionEntity();
        permissionEntity.setReviewGroupEntities(reviewGroupEntities);  // define the groups whose changes the userEntity can accept/reject
        permissionEntity.setCommentsViewGroupEntities(commentViewGroupEntities);  // defines the groups whose comments the userEntity can view
        permissionEntity.setCommentsEditGroupEntities(commentEditGroupEntities);  // defines the groups whose comments the userEntity can edit
        permissionEntity.setCommentsRemoveGroupEntities(commentRemoveGroupEntities);  // defines the groups whose comments the userEntity can remove
        permissionEntity.setUserInfoGroupEntities(userInfoGroupEntities);
        permissionEntity.setChat(chat);

//        permissionRepository.save(permissionEntity);  // save new permissions

        return permissionEntity;
    }

    // update permissions
    public PermissionEntity updatePermission(PermissionEntity newPermissionEntity){
//        permissionRepository.save(newPermissionEntity);  // save new permissions

        return newPermissionEntity;
    }
}
